import {RoutesInterface} from "@/interface/routesInterface";
import {Router} from "express";
import UsersController from "@/controllers/UsersController";

export default class usersRoutes implements RoutesInterface {
    path: string = '/users';
    router: Router = Router();
    userController:UsersController;
    constructor() {
        this.userController=new UsersController()
        this.initUsersRoute()
    }
    private initUsersRoute(){

        /**
         * 新增用户
         */
        this.router.post(`${this.path}`,this.userController.createUser)
        /**
         * 删除用户
         */
        this.router.delete(`${this.path}`,this.userController.deleteUser)
        /**
         * 更新用户
         */
        this.router.put(`${this.path}`,this.userController.updateUser)
        /**
         * 查找用户
         */
        this.router.get(this.path,this.userController.getUsers);
        /**
         * 登录
         */
        this.router.post(`${this.path}/login`,this.userController.login)

    }

}